Page({
  onLoad({ point, building }) {
    this.fake(point, building)
  },
  fake(point, building) {
    // 需求: 生成 101 102 103 ... 类似的随机房间号
    const size = Math.floor(Math.random() * 7) + 3
    let rooms = []
    for (let i = 0; i < size; i++) {
      // 12 0 1
      // 楼层: 1 ~ 25 层之间
      const floor = Math.floor(Math.random() * 24) + 1
      // 房间号: 1 ~ 4 户之间
      const n = Math.floor(Math.random() * 3) + 1
      // 拼成房间号
      const room = floor + '0' + n
      // console.log(room)
      // 往数组中添加元素之前先做一次判断
      if (!rooms.includes(room)) {
        rooms.push(room)
      }
    }
    // console.log(rooms)
    rooms.sort((a, b) => a - b)
    // set 去重: set 中的元素都是唯一的
    // rooms = [...new Set(rooms)]
    this.setData({ point, building, rooms })
  }
})